package com.yonyou.crm.sys.modules.service;

import org.springframework.stereotype.Service;
import com.yonyou.crm.common.biz.service.BaseBizServiceImpl;
import com.yonyou.crm.sys.modules.entity.CustomIdGeneratorVO;
import com.yonyou.iuap.context.InvocationInfoProxy;

/**
 * 利用数据库机制生成ID。
 */
@Service
public class CustomIdGeneratorBizServiceImpl extends BaseBizServiceImpl<CustomIdGeneratorVO>{
	
	/**
	 * 获取ID
	 * 
	 * @return
	 */
	public Long getId() {
		CustomIdGeneratorVO customIdGeneratorVO = new CustomIdGeneratorVO();
		String tenantIdStr = (String) InvocationInfoProxy.getTenantid();
		Long tenantId = Long.parseLong(tenantIdStr);
		customIdGeneratorVO.setTenantId(tenantId);
		customIdGeneratorVO = super.saveVO(customIdGeneratorVO);
		return customIdGeneratorVO.getId();
	}
	
}



